using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._MappingClusters
{
    /// <summary>
    /// <para>Multivariate Clustering</para>
    /// <para>Finds natural clusters of features based solely on feature attribute values.</para>
    /// <para>仅根据要素属性值查找要素的自然聚类。</para>
    /// </summary>    
    [DisplayName("Multivariate Clustering")]
    public class MultivariateClustering : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public MultivariateClustering()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The feature class or feature layer for which you want to create clusters.</para>
        /// <para>要为其创建聚类的要素类或要素图层。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The new output feature class created containing all features, the analysis fields specified, and a field indicating to which cluster each feature belongs.</para>
        /// <para>创建的新输出要素类包含所有要素、指定的分析字段以及指示每个要素所属聚类的字段。</para>
        /// </param>
        /// <param name="_analysis_fields">
        /// <para>Analysis Fields</para>
        /// <para>A list of fields you want to use to distinguish one cluster from another.</para>
        /// <para>要用于区分一个集群与另一个集群的字段列表。</para>
        /// </param>
        public MultivariateClustering(object _in_features, object _output_features, List<object> _analysis_fields)
        {
            this._in_features = _in_features;
            this._output_features = _output_features;
            this._analysis_fields = _analysis_fields;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Multivariate Clustering";

        public override string CallName => "stats.MultivariateClustering";

        public override List<string> AcceptEnvironments => ["MResolution", "MTolerance", "XYResolution", "XYTolerance", "ZResolution", "ZTolerance", "geographicTransformations", "outputCoordinateSystem", "outputMFlag", "outputZFlag", "outputZValue", "qualifiedFieldNames", "randomGenerator", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_features, _output_features, _analysis_fields, _clustering_method.GetGPValue(), _initialization_method.GetGPValue(), _initialization_field, _number_of_clusters, _output_table];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The feature class or feature layer for which you want to create clusters.</para>
        /// <para>要为其创建聚类的要素类或要素图层。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The new output feature class created containing all features, the analysis fields specified, and a field indicating to which cluster each feature belongs.</para>
        /// <para>创建的新输出要素类包含所有要素、指定的分析字段以及指示每个要素所属聚类的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Analysis Fields</para>
        /// <para>A list of fields you want to use to distinguish one cluster from another.</para>
        /// <para>要用于区分一个集群与另一个集群的字段列表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Analysis Fields")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _analysis_fields { get; set; }


        /// <summary>
        /// <para>Clustering Method</para>
        /// <para><xdoc>
        ///   <para>The clustering algorithm used. K means is the default.</para>
        ///   <para>K means and K medoids are both popular clustering algorithms and will generally produce similar results. However, K medoids is more robust to noise and outliers in the Input Features. K means is generally faster than K medoids and is preferred for large data sets.</para>
        ///   <bulletList>
        ///     <bullet_item>K means—The Input Features will be clustered using the K means algorithm. This is the default.</bullet_item><para/>
        ///     <bullet_item>K medoids—The Input Features will be clustered using the K medoids algorithm.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>使用的聚类分析算法。K 表示是默认值。</para>
        ///   <para>K 均值和 K medoids 都是流行的聚类算法，通常会产生类似的结果。但是，K 中位体对输入特征中的噪声和异常值更鲁棒。K 均值通常比 K 中型均值快，是大型数据集的首选。</para>
        ///   <bulletList>
        ///     <bullet_item>K 均值—将使用 K 均值算法对输入要素进行聚类。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>K medoids—将使用 K medoids 算法对输入要素进行聚类。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Clustering Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _clustering_method_value _clustering_method { get; set; } = _clustering_method_value._K_MEANS;

        public enum _clustering_method_value
        {
            /// <summary>
            /// <para>K means</para>
            /// <para>K means—The Input Features will be clustered using the K means algorithm. This is the default.</para>
            /// <para>K 均值—将使用 K 均值算法对输入要素进行聚类。这是默认设置。</para>
            /// </summary>
            [Description("K means")]
            [GPEnumValue("K_MEANS")]
            _K_MEANS,

            /// <summary>
            /// <para>K medoids</para>
            /// <para>K medoids—The Input Features will be clustered using the K medoids algorithm.</para>
            /// <para>K medoids—将使用 K medoids 算法对输入要素进行聚类。</para>
            /// </summary>
            [Description("K medoids")]
            [GPEnumValue("K_MEDOIDS")]
            _K_MEDOIDS,

        }

        /// <summary>
        /// <para>Initialization Method</para>
        /// <para><xdoc>
        ///   <para>Specifies how initial seeds to grow clusters are obtained. If you indicate you want three clusters, for example, the analysis will begin with three seeds.</para>
        ///   <bulletList>
        ///     <bullet_item>Optimized seed locations—Seed features will be selected to optimize analysis results and performance. This is the default.</bullet_item><para/>
        ///     <bullet_item>User defined seed locations—Nonzero entries in the Initialization Field will be used as starting points to grow clusters.</bullet_item><para/>
        ///     <bullet_item>Random seed locations—Initial seed features will be randomly selected.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何获取用于生长簇的初始种子。例如，如果您指示需要三个聚类，则分析将从三个种子开始。</para>
        ///   <bulletList>
        ///     <bullet_item>优化的种子位置—将选择种子特征以优化分析结果和性能。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>用户定义的种子位置 - 初始化字段中的非零条目将用作种植集群的起点。</bullet_item><para/>
        ///     <bullet_item>随机种子位置—将随机选择初始种子要素。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Initialization Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _initialization_method_value _initialization_method { get; set; } = _initialization_method_value._OPTIMIZED_SEED_LOCATIONS;

        public enum _initialization_method_value
        {
            /// <summary>
            /// <para>Optimized seed locations</para>
            /// <para>Optimized seed locations—Seed features will be selected to optimize analysis results and performance. This is the default.</para>
            /// <para>优化的种子位置—将选择种子特征以优化分析结果和性能。这是默认设置。</para>
            /// </summary>
            [Description("Optimized seed locations")]
            [GPEnumValue("OPTIMIZED_SEED_LOCATIONS")]
            _OPTIMIZED_SEED_LOCATIONS,

            /// <summary>
            /// <para>User defined seed locations</para>
            /// <para>User defined seed locations—Nonzero entries in the Initialization Field will be used as starting points to grow clusters.</para>
            /// <para>用户定义的种子位置 - 初始化字段中的非零条目将用作种植集群的起点。</para>
            /// </summary>
            [Description("User defined seed locations")]
            [GPEnumValue("USER_DEFINED_SEED_LOCATIONS")]
            _USER_DEFINED_SEED_LOCATIONS,

            /// <summary>
            /// <para>Random seed locations</para>
            /// <para>Random seed locations—Initial seed features will be randomly selected.</para>
            /// <para>随机种子位置—将随机选择初始种子要素。</para>
            /// </summary>
            [Description("Random seed locations")]
            [GPEnumValue("RANDOM_SEED_LOCATIONS")]
            _RANDOM_SEED_LOCATIONS,

        }

        /// <summary>
        /// <para>Initialization Field</para>
        /// <para>The numeric field identifying seed features. Features with a value of 1 for this field will be used to grow clusters. All other features should contain zeros.</para>
        /// <para>标识种子要素的数值字段。此字段的值为 1 的要素将用于种植聚类。所有其他要素都应包含零。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Initialization Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _initialization_field { get; set; } = null;


        /// <summary>
        /// <para>Number of Clusters</para>
        /// <para><xdoc>
        ///   <para>The number of clusters to create. When you leave this parameter empty, the tool will evaluate the optimal number of clusters by computing a pseudo F-statistic for clustering solutions with 2 through 30 clusters.</para>
        ///   <para>This parameter is disabled if the seed locations were provided in an initialization field.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要创建的集群数。如果将此参数留空，则该工具将通过计算具有 2 到 30 个聚类的聚类解决方案的伪 F 统计量来评估最佳聚类数。</para>
        ///   <para>如果在初始化字段中提供了种子位置，则禁用此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Clusters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _number_of_clusters { get; set; } = null;


        /// <summary>
        /// <para>Output Table for Evaluating Number of Clusters</para>
        /// <para>If specified, the table created contains the pseudo F-statistic for clustering solutions 2 through 30, calculated to evaluate the optimal number of clusters. The chart created from this table can be accessed in the stand-alone tables section of the Contents pane.</para>
        /// <para>如果指定，则创建的表包含聚类解 2 到 30 的伪 F 统计量，计算用于评估最佳聚类数。根据此表创建的图表可在内容窗格的独立表部分中访问。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table for Evaluating Number of Clusters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_table { get; set; } = null;


        public MultivariateClustering SetEnv(object MResolution = null, object MTolerance = null, object XYResolution = null, object XYTolerance = null, object ZResolution = null, object ZTolerance = null, object geographicTransformations = null, object outputCoordinateSystem = null, object outputMFlag = null, object outputZFlag = null, object outputZValue = null, bool? qualifiedFieldNames = null, object randomGenerator = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(MResolution: MResolution, MTolerance: MTolerance, XYResolution: XYResolution, XYTolerance: XYTolerance, ZResolution: ZResolution, ZTolerance: ZTolerance, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, outputMFlag: outputMFlag, outputZFlag: outputZFlag, outputZValue: outputZValue, qualifiedFieldNames: qualifiedFieldNames, randomGenerator: randomGenerator, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}